package entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MemberInfo extends BaseEntity {
	private String id;
	private Date admissionDate;
	private int giftPoint;
	private float balance;
	private boolean status;

	public MemberInfo(String dataString) throws ParseException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
		String[] attrVal = dataString.split(" ");

		this.setId(attrVal[1]);

		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd");
		this.admissionDate = formatter.parse(attrVal[2]);
		this.giftPoint = Integer.parseInt(attrVal[3]);
		this.balance = Float.valueOf(attrVal[4]);
		
		if(attrVal[5].equals("true")){
			this.status=true;	
		} else {
			this.status=false;
		}
	}

	public MemberInfo(String id2, Date date, int giftPtn, float bal, String status2) {
		this.id=id2;
		this.admissionDate=date;
		this.giftPoint=giftPtn;
		this.balance=bal;
		if(status2=="1"){
			this.status=true;	
		} else {
			this.status=false;
		}
	}
	
	public Date getAdmissionDate() {
		return admissionDate;
	}

	public void setAdmissionDate(Date admissionDate) {
		this.admissionDate = admissionDate;
	}

	public float getBalance() {
		return balance;
	}

	public void setBalance(float balance) {
		this.balance = balance;
	}

	public int getGiftPoint() {
		return this.giftPoint;
	}

	public void setGiftPoint(int p) {
		this.giftPoint = p;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public boolean isStatus() {
		return status;
	}
}
